package com.fastloan.mgt.model.service.arithmetic.jx;

import com.fastloan.mgt.application.base.model.Application;
import com.fastloan.mgt.application.contract.model.ApplicationContract;
import com.fastloan.mgt.customer.model.CustomerAmount;
import com.fastloan.mgt.customer.service.CustomerAmountService;
import com.fastloan.mgt.model.annotation.ModelClass;
import com.fastloan.mgt.model.model.ApplicationModel;
import com.fastloan.mgt.model.service.GeneratorModelStrategy;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.function.Consumer;

import static com.fastloan.mgt.application.base.enums.ApplicationStatusEnum.PRELIMINARY_CREDIT;
import static com.fastloan.mgt.model.service.impl.ModelCalculateServiceImpl.PASS;

/**
 * @author yanwe
 * createTime 2017-12-2017/12/20 18:00
 */
@Component
@ModelClass(modelName = "预授信模型", modelId = 4)
public class JxCreditModel extends GeneratorModelStrategy {

    @Override
    public void calculate(String applicationId, Consumer<ApplicationModel> applicationModelConsumer) {
        ApplicationModel applicationModel = createApplicationModel(applicationId);
        Application applicationInfo = getApplicationInfo(applicationId);
        applicationInfo.setApplicationStatus(PRELIMINARY_CREDIT.getType());
        applicationService.updateByPrimaryKeySelective(applicationInfo);
        applicationModel.setPass(PASS);
        applicationModelConsumer.accept(applicationModel);
    }


    @Override
    public void sendBack(ApplicationContract applicationContract, boolean isPass) {

    }

}
